package com.cafuc.thread;

import org.apache.commons.lang3.StringUtils;


public class MyRunnable implements Runnable {
    private String name;

    public MyRunnable() {
    }

    public MyRunnable(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Override
    public void run() {
        System.out.println(String.format("==== 开启线程 MyRunnable %s====",
                StringUtils.isNotBlank(getName()) ? getName() : ""));
        try {
            Thread.sleep(5000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println(String.format("==== 关闭线程 MyRunnable %s====",
                StringUtils.isNotBlank(getName()) ? getName() : ""));
    }
}